/*
class Car1 {
  constructor() {
  }
}
const Car = Car1
console.log(Car1)
console.log(Car.prototype.constructor)*/

/*const car = new class {
  constructor() {
    this.name = "car"
  }
}()
console.log(car)*/

class Person {
  constructor(name = "张三", age = 22) {
    this.name = name
    this.age = age
  }
  count = 100
  sayHi() {
    console.log("hi !!!")
    return 123
  }
  get prop() {
    return "getter"
  }
  set prop(val) {
    console.log("set:", val)
  }
  static method1() {
    console.log(this.prototype.color)
    console.log(this.prototype.sayHi)
    console.log(arguments)
  }
}
Person.prototype.color = "yellow"

// class 子类 extends 父类 {}
class ShanxiPerson extends Person {
  constructor(name, age, form = "无") {
    super(name, age);
    this.from = form
  }
  sayHi() {
    console.log("我重写了 sayHi", super.prop)
  }
}

let sP1 = new ShanxiPerson()
let sP2 = new ShanxiPerson("lisi", "38", "渭南")
console.log(sP1)
console.log(sP2)


// let p1 = new Person()
// let p2 = new Person("李四")
// console.log(p1)
// console.log(p2)
// console.log(p2.sayHi())
// console.log("=======")
// console.log(sP1 instanceof ShanxiPerson)
// console.log(sP1 instanceof Person)
// console.log(sP1)
// console.log(sP2)
// console.log(ShanxiPerson.method1())
// console.log(sP1.sayHi())
// console.log(sP2.prop)
// console.log(sP2.method1)



// console.log(Person.prototype.constructor)
// console.log(p1.__proto__.constructor)
// console.log(typeof Person)
// console.log(Person.prototype === p1.__proto__)
// console.log(p1.sayHi())

// Person.method1()
// p1.method1()
// const f = () => {}
// console.log(p1.prop)
// console.log(p1.prop = "hello")
// console.log(p1.age, p1.name)
// console.log(p1.color)
// console.log(p1.toString())

// 语法糖





